﻿using System.Collections.Generic;
using System.Globalization;

namespace Wp7Tools.Google {
    public static class GoogleNedProvider {

        private static Dictionary<string,string> _isoNameNedDic = new Dictionary<string, string>();

        static GoogleNedProvider() {
            Add("au"); //Australia
            Add("in"); //India
            Add("de"); //Germany
            Add("es"); //Spain
            Add("fr"); //France
            Add("ie","en_ie"); //Ireland
            Add("it"); //Italy
            Add("at","de_at"); //Austria
            Add("pt","pt-PT_pt"); //Portugal
            Add("ru","ru_ru"); //Russia
            
            Add("ar","es_ar"); //Argentina
            Add("br","pt-BR_br"); //Brasil
            Add("ca"); //Canada en
            Add("cl","es_cl"); //Chile
            Add("co", "es_co"); //Colombia
            Add("us"); //USA
             
        }

        private static void Add(string isoName, string ned) {
            _isoNameNedDic.Add(isoName.ToLower(), ned);
        }

        private static void Add(string isoName) {
            Add(isoName, isoName);
        }

        public static string GetNedForCurrentCulture() {
            string iso = RegionInfo.CurrentRegion.TwoLetterISORegionName.ToLower();
            return _isoNameNedDic.ContainsKey(iso) ? _isoNameNedDic[iso] : "us";
        }
    }
}
